﻿using AutoMapper;
using Enferno.Public.Web.Models;
using Enferno.StormApiClient.Shopping;
using Enferno.Web.StormUtils;

namespace Enferno.Public.Web.Mappers.CheckoutProfiles
{
    public class PaymentServiceToPaymentServiceModelProfile :
        PaymentServiceToPaymentServiceBaseModelProfile<PaymentServiceModel>
    {
        
    }

    public class PaymentServiceToPaymentServiceBaseModelProfile<TPaymentServiceModel>: Profile
        where TPaymentServiceModel: PaymentServiceModel
    {
        protected override void Configure()
        {
            Mapper.CreateMap<PaymentService, TPaymentServiceModel>()
                .ForMember(to => to.ImageUrl, opts => opts.MapFrom(from => Link.ImageUrl(from.ImageKey, null)));
        }
    }
}
